#include <iostream>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <unordered_set>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const int N=1e5+10;
pii a[N];
ll tar=0;
int n;
bool cmp(pii a,pii b)
{
    int g1=a.first,v1=a.second;
    int g2=b.second, v2=b.second;
    return ((double)g2/v2)<((double)g1/v1);
}

int check(ll v)
{
    ll sum=0;
    for(int i=1;i<=n;i++)
    {
        v-=a[i].second;
        sum=sum+v*a[i].first;
    }
    return sum>=tar;
}

int main()
{   
    cin>>n>>tar;
    for(int i=1;i<=n;i++)
    {
        scanf("%d %d",&a[i].first,&a[i].second);
    }
    sort(a+1,a+1+n,cmp);
    ll sum=0;
    for(int i=1;i<=n;i++)
    {
        printf("%d %d\n",a[i].first,a[i].second);
        sum+=a[i].second;
    }
    
    ll l=sum;
    ll r=1e9+1000;
    while(l<r)
    {
        ll mid=l+r>>1;
        if(check(mid))
        {
            r=mid;
        }
        else l=mid+1;
    }
    cout<<l;

	return 0;
}

